import { defineAsyncComponent , h } from 'vue';
import Loding from '../components/Loding.vue';
import ErrorCom from '../components/Error.vue';

function random(max,min) {
    return Math.floor(Math.random(max - min) * min) + min;
}

/**
 * 异步加载组件
 * @param {*} path 路径 
 * @returns 
 */
export function getAsyncComponent(path) {
    return defineAsyncComponent({
        loader:()=> import(`../views/${path}`),
        loadingComponent:Loding,
        errorComponent: ErrorCom,
    })
}